package com.zwj.controller;


import com.zwj.bo.CourseBo;
import com.zwj.dto.Result;
import com.zwj.entity.CourseEntity;
import com.zwj.service.CourseService;
import com.zwj.service.CourseService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zwj
 * @since 2021-10-30
 */
@RestController
@RequestMapping("/course")
public class CourseController {
    private final CourseService courseService;

    public CourseController(CourseService courseService) {
        this.courseService = courseService;
    }
    //添加课程
    @PostMapping("/addCourse")
    public Result addCourse(@RequestBody CourseEntity courseEntity) {
        return courseService.addCourse(courseEntity);
    }
    //删除课程 逻辑删除
    @PostMapping("/deleteCourse")
    public Result deleteCourse(@RequestBody CourseBo courseBo) {
        return courseService.deleteCourse(courseBo);
    }
    //修改课程
    @PostMapping("/updateCourse")
    public Result updateCourse(@RequestBody CourseEntity courseEntity) {
        return courseService.updateCourse(courseEntity);
    }
    //查询课程
    @PostMapping("/seleteCourse")
    public Result seleteCourse(@RequestBody CourseBo courseBo) {
        return courseService.seleteCourse(courseBo);
    }
}

